home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Tools / CatComp.doc < prev    next >
Encoding:
Text File  |  1999-10-29  |  34.3 KB  |  948 lines

  1.  
  2.                   $VER: CatComp_Documentation 44.6 (29.10.99)
  3.                   ==========================================
  4.  
  5. CatComp is a program to handle the creation and maintenance of the message
  6. catalogs used by locale.library. Message catalogs are IFF files read by
  7. locale.library that contain all the text strings used by an application. By
  8. providing several of these catalog files, an application can use
  9. locale.library and transparently adapt itself to the user's preferred language.
  10.  
  11. CatComp reads and processes two kinds of input files, and produces five types
  12. of output files.
  13.  
  14. The first kind of file read by CatComp is a catalog description file. That
  15. file describes all the strings used by an application. There is one such file
  16. per localized application. In this file, you assign numbers to all the
  17. application strings as well as specify their minimum and maximum lengths.
  18.  
  19. The second kind of file read by CatComp is a catalog translation file. That
  20. file contains all strings from the application translated to one language.
  21. There is one catalog translation file per language supported by a localized
  22. application.
  23.  
  24. CatComp can produce several different kinds of output files. The first is an IFF
  25. catalog. These are regular IFF files. There is one catalog produced for every
  26. catalog text file successfully processed. Catalogs are read directly by
  27. locale.library whenever the OpenCatalog() call is made.
  28.  
  29. The second type of file output by CatComp is an empty translation file. This
  30. is useful when starting a translation. It lets CatComp convert a catalog
  31. description file into a ready to fill-in translation file.
  32.  
  33. The third and fourth type of files output by CatComp are C and Assembly
  34. language programming source files. These are used by application writers to
  35. convert catalog description files into source files that can be directly used
  36. in their applications.
  37.  
  38. The fifth and sixth type of files output by CatComp are Modula-2 language
  39. definition and implementation source files, which are used by programmers
  40. in much the same way C and Assembly files are used.
  41.  
  42. Finally, the last type of file output by CatComp is an AmigaDOS load file.
  43. These load files are used by application writers to include a set of strings
  44. directly inside an application. This is normally used to encode the default
  45. strings that an application uses when there are no external catalogs available.
  46.  
  47.  
  48. Invoking CatComp
  49. ----------------
  50.  
  51. CatComp can only by run from the Shell under Kickstart V37 or beyond. Its
  52. template is:
  53.  
  54.   DESCRIPTOR/A,TRANSLATION,CATALOG/K,CTFILE/K,CFILE/K,ASMFILE/K,M2FILE/K,
  55.   OBJFILE/K,SYMBOLS/M/K,VB=VERBOSITY/N/K,NOOPTIM/S,NONUMBERS/S,NOSTRINGS/S,
  56.   NOARRAY/S,NOBLOCK/S,NOCODE/S,XDEF/S
  57.  
  58.   DESCRIPTOR/A
  59.   Specifies the name of a catalog description file. Typically, the file
  60.   extension for catalog description files is .cd
  61.  
  62.   TRANSLATION
  63.   Specifies the name of a catalog translation file. Typically, the
  64.   file extension for catalog translation files is .ct
  65.  
  66.   CATALOG/K
  67.   Specifies the name of the IFF catalog file to produce. When this option
  68.   is specified, a translation file must have been given in the previous
  69.   argument.
  70.  
  71.   CTFILE/K
  72.   Specifies the name of the blank catalog translation file to produce. This
  73.   option only requires a catalog descriptor file be provided, there is no need
  74.   for a translation file.
  75.  
  76.   CFILE/K
  77.   Specifies the name of the C-language source file header to produce. This
  78.   option only requires a catalog descriptor file be provided, there is no need
  79.   for a translation file.
  80.  
  81.   ASMFILE/K
  82.   Specifies the name of the Assembly-language source file header to produce.
  83.   This option only requires a catalog descriptor file be provided, there is
  84.   no need for a translation file.
  85.  
  86.   M2FILE/K
  87.   Specifies the _base_ name of the Modula-2 source files to produce. Two
  88.   files are actually generated. The first file has the base name with the
  89.   extension .def, the second has the extension .mod added.
  90.  
  91.   OBJFILE/K
  92.   Specifies the name of the AmigaDOS binary object file to produce.
  93.   This option only requires a catalog descriptor file be provided, there is
  94.   no need for a translation file.
  95.  
  96.   SYMBOLS/M/K
  97.   Specifies any number of symbols that are used to determine which section
  98.   of the available strings get included within generated C, Assembly, and
  99.   object files.
  100.  
  101.   VERBOSITY/N/K
  102.   Specifies the amount of information CatComp should output while doing some
  103.   processing. The lower this number, the less CatComp will output messages.
  104.   Not providing this option causes CatComp to output every message it could.
  105.  
  106.   NOOPTIM/S
  107.   When generating a catalog file, CatComp normally skips strings that are
  108.   identical in the catalog descriptor file and in the catalog translation
  109.   file and does not include them in the generated catalog file. This
  110.   option disables this optimization.
  111.  
  112.   NONUMBERS/S
  113.   This option is only useful when generate C or Assembly-language header
  114.   files. It prevents the generation of the CATCOMP_NUMBERS section within
  115.   the header file.
  116.  
  117.   NOSTRINGS/S
  118.   This option is only useful when generate C or Assembly-language header
  119.   files. It prevents the generation of the CATCOMP_STRINGS section within
  120.   the header file.
  121.  
  122.   NOARRAY/S
  123.   This option is only useful when generate C or Assembly-language header
  124.   files. It prevents the generation of the CATCOMP_ARRAY section within
  125.   the header file.
  126.  
  127.   NOBLOCK/S
  128.   This option is only useful when generate C or Assembly-language header
  129.   files. It prevents the generation of the CATCOMP_BLOCK section within
  130.   the header file.
  131.  
  132.   NOCODE/S
  133.   This option is only useful when generate C or Assembly-language header
  134.   files. It prevents the generation of the CATCOMP_CODE section within
  135.   the header file.
  136.  
  137.   XDEF/S
  138.   This option is only useful when generate Assembly-language header files.
  139.   It adds XDEF declarations for all IDs (CATCOMP_NUMBERS section) and 
  140.   string labels (CATCOMP_STRINGS section).
  141.  
  142.  
  143. Catalog Description Files
  144. -------------------------
  145.  
  146. Catalog description files completely describe the strings used by an
  147. application. The format for these files is basically a series of two line
  148. entries separated by an arbitrary number of comment lines. The EBNF (Extended
  149. Backus Naur Formalism) specification for catalog description files is:
  150.  
  151. {# command}
  152. {; comment line}
  153. <string name> "(" [string id] "/" [min string len] "/" [max string len] ")"
  154. [string]
  155.  
  156. The first line indicates special commands that provide control over the
  157. generation of C, Assembly, and object files. See the section on C and Assembly
  158. source files below for further information.
  159.  
  160. <string name> is the symbolic name of the string. Following the name comes
  161. three optional numbers enclosed in parenthesis and separated with slashes. The
  162. first number specifies the string's ID value. This is the ID value used to
  163. request this string when using the GetCatalogStr() call in locale.library. The
  164. second number specifies the minimum length for the string, while the third
  165. number specifies the maximum string length.
  166.  
  167. The next line of an entry contains the actual string. Within the catalog
  168. description file, the strings are the same as the default strings built into
  169. the application. The strings can use standard C-language backslash ("\")
  170. escape sequences. If a string ends with a backslash character, this means
  171. that the next line in the file should be considered a continuation of the
  172. current line.
  173.  
  174. Finally, any string entry can be separated from other entries by comment
  175. lines. Comment lines start with a semicolon. There can be any number of
  176. comment lines between two entries. It is not allowed to put comment lines
  177. between the two lines of a same entry.
  178.  
  179. Here's an example of two strings in a catalog description file:
  180.  
  181. MSG_HELLO (0/4/50)
  182. This is a test string for the world to see
  183. ;
  184. MSG_BYE (1/14/47)
  185. This is another test string
  186.  
  187. The first string is called MSG_HELLO, has 0 as ID value, can be as short
  188. as 4 characters and as long as 50. The string actually associated with the
  189. name follows on the next line. Then comes a comment line. Following that is
  190. the definition of the second string called BYE_WORLD_STR that has 1 as ID
  191. value, can be as short as 14 characters and as long as 47.
  192.  
  193. As mentioned above, all three numbers in an entry are optional. If the string
  194. id number is not specified, then the same id as the previous string in the
  195. file plus one is used. If the first string defined has no id value, the
  196. starting id value is 0. If the minimum string length is not specified, it is
  197. assumed to be 0. And finally, if the maximum string length is not specified,
  198. it is assumed to be unlimited.
  199.  
  200. All three numbers can be provided in hexadecimal by preceeding themby
  201. a $. For string IDs, it is also possible to specify a relative value. That
  202. is, by providing an ID value of "+1", you are telling CatComp to add one
  203. to the ID number this string was going to receive. This is useful over
  204. the course of evolution of a program, when certain strings need to be removed.
  205. An example would be:
  206.  
  207. MSG_HELLO (0/4/50)
  208. This is a test string for the world to see
  209. ;
  210. MSG_BYE (+1/14/47)
  211. This is another test string
  212. ;
  213. MSG_WELCOME (//)
  214. This is still a test string!
  215.  
  216. In this case, MSG_HELLO would have the value 0, MSG_BYE the value 2,
  217. and MSG_WELCOME the value 3.
  218.  
  219. A note on style here. It is relatively important to choose descriptive
  220. symbolic names for the strings. These names will be viewed by the translators
  221. and should be as meaningful as possible. The following conventions are
  222. suggested:
  223.  
  224.   - List all names in capital letters. This will make it clear they are
  225.     constants as this is the convention used in all Amiga include files.
  226.  
  227.   - Prefix each name with the string MSG_. This will make it clear to the
  228.     programmer that a given constant is in fact a string ID value.
  229.  
  230.   - Append the string _GAD to strings that are used for gadget labels.
  231.  
  232.   - Append the string _MENU to strings that are used for menu titles. For
  233.     example, MSG_EDIT_MENU.
  234.  
  235.   - Expand the path leading to a menu item when specifying strings that are
  236.     used for menu items. For example, for the Cut item in the Edit menu
  237.     would be written as MSG_EDIT_CUT.
  238.  
  239.  
  240. Catalog Translation Files
  241. -------------------------
  242.  
  243. Catalog translation files contain all the strings of an application translated
  244. to a different language than the default. The files look very similar to
  245. catalog description files, except they do not include the string id, minimum
  246. string length and maximum string length specifications. The EBNF specification
  247. for catalog translation files is:
  248.  
  249. {# command}
  250. {; comment line}
  251. <string name>
  252. [string]
  253.  
  254. The first line indicates special commands that describe attributes of the
  255. catalog file. There are currently five supported commands. "version" lets you
  256. specify a 2.0-style version string for the catalog. "language" lets you list
  257. the language that this catalog is in. This string should itself be in the
  258. given language and not in English. "codeset" lets you specify which code set
  259. this catalog requires. This value should currently always be 0. "rcsid" lets
  260. you specify a version string using the standard RCS method. That way, versions
  261. of catalogs can get updated automatically by RCS. The format for the rcsid
  262. command is:
  263.  
  264.   ## rcsid $Date: 93/08/12 16:37:57 $ $Revision: 39.8 $
  265.  
  266. For example:
  267.  
  268.   ## rcsid $Date: 93/08/12 16:37:57 $ $Revision: 39.8 $
  269.  
  270. The last command supported is "name" which can be used in conjunction with the
  271. "rcsid" command to specify the name component of a 2.0 version string. That is:
  272.  
  273. ## rcsid $Date: 93/08/12 16:37:57 $ $Revision: 39.8 $
  274. ## name myprogram.catalog
  275.  
  276. The above will embed "$VER: myprogram.catalog 39.1 (31.7.92)" inside of the
  277. message catalog. Another example:
  278.  
  279. ## version $VER: myprogram.catalog 39.1 (31.7.92)
  280. ## codeset 0
  281. ## language francais
  282. ;
  283. MSG_HELLO
  284. Ceci est une chaine test pour ĂȘtre vue
  285. ;
  286. MSG_BYE
  287. Ceci est une autre chaine test
  288.  
  289. The first three lines are command lines. The following line is a comment line
  290. as it starts with a semicolon. The following line you list the symbolic name
  291. of the string, and on the second line the translated string. If a string ends
  292. with a backslash character, this means that the next line in the file should
  293. be considered a continuation of the current line.
  294.  
  295. The symbolic name is the same as the related entry in the catalog description
  296. file. CatComp uses this name to associate entries from translation files with
  297. entries in description files. It can then validate the strings in the
  298. translation files by ensuring they are of the correct length, etc.
  299.  
  300.  
  301. Escape Sequences Supported
  302. --------------------------
  303.  
  304. Regular C-language escape sequences can be specified in strings, along with a
  305. few additions:
  306.  
  307.   \a    inserts an audible bell character (ASCII 7)
  308.   \b    inserts a backspace character (ASCII 8)
  309.   \c    inserts a control sequence introducer (ASCII 155)
  310.   \e    inserts an escape character (ASCII 27)
  311.   \f    inserts a formfeed character (ASCII 12)
  312.   \n    inserts a newline character (ASCII 10)
  313.   \r    inserts a carriage return character (ASCII 13)
  314.   \t    inserts a tab character (ASCII 9)
  315.   \v    inserts a vertical tab character (ASCII 11)
  316.   \xNN  inserts NN, where NN specifies an ASCII code in hexadecimal
  317.   \NNN  inserts NNN, where NNN specifies an ASCII code in octal
  318.  
  319. As well, when any string line within a description or translation file ends
  320. with a backslash ("\"), it means that the following line within the file is
  321. to be considered a continuation of the current line.
  322.  
  323.  
  324. Formatted Output Commands
  325. -------------------------
  326.  
  327. CatComp parses strings for C-language formatting commands as used in the
  328. printf() function. It ensures that the number and type of such commands are
  329. the same in both the description file and the translation files. This
  330. guarantees that the application stack frame will not be misinterpreted due to
  331. incorrect translations of formatting commands.
  332.  
  333. CatComp warns you if you attempt to use any non-C formatting commands. The
  334. commands that CatComp does understand are:
  335.  
  336.     %b  %c  %d  %e  %E  %f  %g  %G  %i  %o  %p  %s  %u  %x  %X  %N  %T
  337.  
  338. CatComp also knows about the ordering formatting command supported by
  339. RawDoFmt() whenever locale.library runs in the system, or by locale's
  340. FormatString() routine. The ordering command lets you specify formatting
  341. commands within a formatting string in a different order than in the original
  342. string, while still accessing the stack frame correctly. CatComp validates the
  343. ordering information and ensures argument types match. See the documentation
  344. locale.library/FormatString().
  345.  
  346. Specifying the argument position lets the order of the % commands within your
  347. strings without affecting how the program performs. Given a string in a
  348. catalog description file such as:
  349.  
  350. MSG_AVAIL_MEM (//)
  351. FAST: %lU, GRAPHIC: %lU
  352.  
  353. This string could be translated in French as:
  354.  
  355. MSG_AVAIL_MEM (//)
  356. GRAPHIQUE: %2$lU, AUTRE %1$lU
  357.  
  358. Using the first string, the output of the program might look like:
  359.  
  360. FAST: 1234, GRAPHIC: 5678
  361.  
  362. while the translation would output:
  363.  
  364. GRAPHIQUE: 5678, AUTRE: 1234
  365.  
  366.  
  367. Validation
  368. ----------
  369.  
  370. CatComp enforces the syntax of catalog description files and catalog
  371. translation files very strongly. It also ensures that the same number of
  372. C-language % command appear in both the description and the translation file.
  373. This guarantees the integrity of the application stack-frame when using
  374. translated string in printf() statements.
  375.  
  376. Most errors detected by CatComp are fatal and cause the program to abort.
  377. Errors are reported to the console with a descriptive error message, a
  378. filename, and if needed a line and column number. Non-fatal errors (warnings)
  379. and also sent to the console, but they do not cause the program to abort. The
  380. printing of these warning messages can be suppressed using the VERBOSITY
  381. command-line option.
  382.  
  383.  
  384. Possible Errors
  385. ---------------
  386.  
  387. Here is a list of the errors and warnings that CatComp can produce, along with
  388. an explanation of what went wrong. Most errors indicate the file, line and
  389. column where the error occurred to help in solving the problem. Note that when
  390. using strings with the line continuation character ("\"), the line numbers
  391. printed will refer to the last line of the strings, even though the error
  392. may be in the first line.
  393.  
  394. ERROR: string line for token <name> not found
  395.   A given token was not followed by a string
  396.  
  397. ERROR: token not found
  398.   No token was found on a line in a catalog description file. Comment lines
  399.   must start with ";", any other line must have a valid token definition on
  400.   it.
  401.  
  402. ERROR: '(' expected
  403.   There was no number section after a token in a catalog description file.
  404.   The number section must start with a (, followed by three optional numbers
  405.   separated by slashes, and terminated by a ).
  406.  
  407. ERROR: ')' expected
  408.   There was no ) after a number section in a catalog description file.
  409.   The number section must start with a (, followed by three optional numbers
  410.   separated by slashes, and terminated by a ).
  411.  
  412. ERROR: '/' expected
  413.   There was no slash found within a number section after a token in a catalog
  414.   description file. The number section must start with a (, followed by three
  415.   optional numbers separated by slashes, and terminated by a ). So there
  416.   must always be two slashes specified.
  417.  
  418. ERROR: garbage characters after token <name>
  419.   There was no number section after a token in a catalog description file,
  420.   and garbage characters were found instead, The number section must start
  421.   with a (, followed by three optional numbers separated by slashes, and
  422.   terminated by a ).
  423.  
  424. ERROR: <name> is not a valid token
  425.   A token in a catalog description file was composed of invalid characters.
  426.   A token must start with a letter and can be followed by letters, numbers and
  427.   underscores.
  428.  
  429. ERROR: token <name> not found
  430.   A token specified in a catalog description file was not present in
  431.   a translation file
  432.  
  433. ERROR: string too short for token <name>
  434.   A string in a translation file is shorter than the minimum length
  435.   specified in the description file.
  436.  
  437. ERROR: string too long for token <name>
  438.   A string in a translation file is shorter than the minimum length
  439.   specified in the description file.
  440.  
  441. ERROR: negative value for minimum length
  442.   The minimum string length specified for a token must be positive.
  443.  
  444. ERROR: negative value for maximum length
  445.   The maximum string length specified for a token must be positive.
  446.  
  447. ERROR: non-positive value for % ordering
  448.   The position information for a % formatting command must be positive and
  449.   greater than 1.
  450.  
  451. ERROR: % ordering value too large
  452.   The position information for a % formatting command is greater than the
  453.   number of formatting commands provided
  454.  
  455. ERROR: % size incorrect
  456.   The size specifier for a % formatting command in a translation file does
  457.   not match the size in the description file.
  458.  
  459. ERROR: % command does not match
  460.   The type specifier for a % formatting command in a translation file does
  461.   not match the size in the description file.
  462.  
  463. ERROR: token <name> defined multiple times
  464.   A token was defined multiple times in either a description or a translation
  465.   file.
  466.  
  467. ERROR: id <number> already used for token <name>
  468.   An attempt was made to reuse an ID value twice within a description file
  469.  
  470. ERROR: no command found after '#'
  471.   Command lines start with # and are followed by a command.
  472.  
  473. ERROR: <name> is not a valid command after '#'
  474.   A command specified after # is invalid.
  475.  
  476. ERROR: <number> is not a valid codeset value
  477.   An incorrect codeset value was specified for a #codeset command.
  478.  
  479. ERROR: <string> is not a valid rcsid value
  480.   A string in an incorrect format was specified for an #rcsid command.
  481.   The format expected is
  482.   ## rcsid $Date: 93/08/12 16:37:57 $ $Revision: 39.8 $
  483.  
  484. ERROR: couldn't write catalog <name>
  485.   An error occurred while writing the catalog file
  486.  
  487. WARNING: <name> is an unknown formatting command
  488.   An unknown % formatting command was specified. CatComp knows only of
  489.   C-language formatting commands, anything else will be flagged
  490.   with this warning.
  491.  
  492. WARNING: string for token <name> matches string in descriptor
  493.   A string within a translation file matches exactly the original string
  494.   from the description file. This may mean that the string was not
  495.   translated. CatComp will not bother putting the string in any
  496.   generated catalog when this situation occurs, unless the NOOPTIM
  497.   command-line option is specified
  498.  
  499. WARNING: original string for token <name> had a trailing ellipsis (...)
  500.   The original string in the catalog descriptor file had a trailing
  501.   ellipsis (such as "Open..."), but the translation did not.
  502.  
  503.  
  504. C, Assembly, and Modula-2 Source Files
  505. --------------------------------------
  506.  
  507. CatComp has the ability to output C, Assembly and Modula-2 language source
  508. file. This lets application programmers manipulate a single catalog description
  509. file and have source files generated for them automatically so they can include
  510. the strings in their programs.
  511.  
  512. To generate these files, you need to give CatComp a descriptor file, and either
  513. a C, Assembly, or Modula-2 output file name using the CFILE/K, ASMFILE/K, and
  514. M2FILE/K command-line options. The resulting files will be standard C,
  515. Assembly, and/or Modula-2 source files that can be used from application code.
  516.  
  517. Both C and Assembly source files contain multiple sections. You can choose
  518. which sections of these files you want in your application by using standard
  519. conditional compilation symbol definitions. Here is a list of the various
  520. symbols and the type of data they hold:
  521.  
  522.   CATCOMP_NUMBERS
  523.   Defining this symbol causes the name of each string to be defined with the
  524.   value of its id, as listed in the catalog description file. So if the .cd
  525.   file contains a string such as:
  526.  
  527.       MSG_HELLO (141//)
  528.       Hello
  529.  
  530.   then the C file generated would have
  531.  
  532.       #define MSG_HELLO 141
  533.  
  534.   and for Assembly:
  535.  
  536.       MSG_HELLO EQU 141
  537.  
  538.   CATCOMP_STRINGS
  539.   Defining this symbol causes each string to be defined. Using the same
  540.   example as above, you would get the following for C:
  541.  
  542.       MSG_HELLO_STR "Hello"
  543.  
  544.   and for Assembly:
  545.  
  546.       MSG_HELLO_STR: DC.B 'Hello',$00
  547.  
  548.   CATCOMP_ARRAY
  549.   Causes a table of the following structures to become available:
  550.  
  551.       struct CatCompArrayType
  552.       {
  553.           LONG   cca_ID;
  554.           STRPTR cca_Str;
  555.       };
  556.  
  557.   cca_ID contains the id value of a string, and cca_Str points to the string
  558.   itself. By scanning this array, you can access all of the strings defined
  559.   for the application.
  560.  
  561.   CATCOMP_BLOCK
  562.   Causes a compact table of all the strings and their id values to be
  563.   generated. The format is:
  564.  
  565.       1 longword of string id
  566.       1 word of string length
  567.       string
  568.       ..etc...
  569.  
  570.   This type of table is difficult to parse in C, and generally better handled
  571.   in Assembly.
  572.  
  573.   CATCOMP_CODE
  574.   This causes the generation of source code for a function called GetString().
  575.   The function takes for argument an initialized LocaleInfo structure and a
  576.   string number. It returns a string pointer. The LocaleInfo structure is:
  577.  
  578.       struct LocaleInfo
  579.       {
  580.           APTR li_LocaleBase;
  581.           APTR li_Catalog;
  582.       }
  583.  
  584.   li_LocaleBase should be initialized to the return value of
  585.   OpenLibrary() of locale.library, or NULL if the library can't be opened.
  586.   li_Catalog should be initialized to the result of OpenCatalog() of the
  587.   application's catalog. This value can be NULL.
  588.  
  589. Command-line options are available to disable the generation of specific
  590. sections of header files. These are NONUMBERS/S, NOSTRINGS/S, NOARRAY/S,
  591. NOBLOCK/S, and NOCODE/S.
  592.  
  593. Special commands can be embedded in catalog description files to provide
  594. control over the generation of header files. These commands are introduced
  595. by a # symbol within the catalog description file. The supported commands
  596. are:
  597.  
  598.   #header <header name>
  599.   This lets you indicate the base name of the header files being produced.
  600.   The base name is then used as the top of header files. For example:
  601.  
  602.       #header TEXTTABLE
  603.  
  604.       would cause the following to be added at the start of the C header file:
  605.  
  606.       #ifndef TEXTTABLE_H
  607.       #define TEXTTABLE_H
  608.  
  609.   #array <array base name>
  610.   This lets you specify the base name of the arrays generated in the header
  611.   files being produced. The default is "CatCompArray"
  612.  
  613.   #block <block base name>
  614.   This lets you specify the base name of the data block generated in the header
  615.   files being produced. The default is "CatCompBlock"
  616.  
  617.   #arrayopts <compiler options>
  618.   This lets you specify which compiler option should be used when
  619.   generating arrays of data. The default is "static const".
  620.  
  621.   #function <function name>
  622.   This lets you specify the name of the function that is generated.
  623.   The default is "GetString"
  624.  
  625.   #prototype <function prototype line>
  626.   This lets you specify the function prototype to output in generated
  627.   C header files. By default, no prototype is generated. For SAS/C, you
  628.   can do something like:
  629.  
  630.     #prototype #include <dos.h>\n
  631.        STRPTR __asm GetString(register __a0 struct LocaleInfo *li,
  632.                               register __d0 ULONG id);
  633.  
  634.   Note that the above three lines actually have to appear on a single line in
  635.   a descriptor file. They are on separate lines here just so they fit
  636.   within an 80 column display. The main purpose for generating a prototype
  637.   is to allow interfacing to the code generated when using the OBJFILE
  638.   option. The prototype lets you define in which registers the parameters are
  639.   expected in by the object code. Since the register specification
  640.   mechanism is compiler-dependant, CatComp can't generate a standard
  641.   prototype that covers all cases, so it requires the explicit specification
  642.   of what the generated prototype should be.
  643.  
  644.   This command is also used when generating Modula-2 source files. It
  645.   specifies the function definition used when generating a .def file.
  646.  
  647.   #m2prolog
  648.   This is used when generating Modula-2 .mod files. It preceeds the
  649.   M2 code that is generated. You can put IMPORT statements and the
  650.   function definition in this command.
  651.  
  652.   #m2epilog
  653.   This is used when generating Modula-2 .mod files. It follows the
  654.   M2 code that is generated. This is normally used to include the
  655.   END <functionname> line after the generated code sequence.
  656.  
  657.   #ifdef <symbol name>
  658.   Causes CatComp to enclose the following identifiers within a conditional
  659.   compilation block.
  660.  
  661.   #endif <symbol name>
  662.   Causes CatComp to terminate the current conditional compilation block.
  663.  
  664.   #lengthbytes <number of bytes>
  665.   Causes CatComp to precede every following strings with 'n' bytes of length
  666.   information. The default number of bytes is 0. The
  667.   locale.library/GetCatalogStr() function will then return a pointer
  668.   to the length bytes, followed by the actual string. The length
  669.   indicated does NOT include the length bytes themselves.
  670.  
  671.  
  672. Object Files
  673. ------------
  674.  
  675. CatComp is capable of generating linkable Amiga load files directly. These
  676. load files contain all the strings for an application, and a very small and
  677. fast routine to return a string pointer given a string id value.
  678.  
  679. The OBJFILE/K option takes the name of an Amiga load file to generate. This
  680. file can then be linked directly with an application. A single function is
  681. available within this load file. It is the Assembly version of the GetString()
  682. function described in the previous section.
  683.  
  684.  
  685. Sample Use
  686. ----------
  687.  
  688. This section presents sample uses of CatComp with example command-lines.
  689.  
  690. Assume you have a catalog description file for an application called "app.cd".
  691.  
  692.  
  693. To test if this file is a valid .cd file, type:
  694.  
  695.   CatComp app.cd
  696.  
  697. and CatComp will respond with either some error messages, or with a message
  698. saying that 'app.cd' is a valid descriptor file.
  699.  
  700.  
  701. To do a translation of a .cd file, you need a .ct file. Such a file can be
  702. generated by doing:
  703.  
  704.   CatComp app.cd CTFILE app.ct
  705.  
  706. This will create a blank translation file called app.ct. You can then load
  707. app.ct in a standard text editor and proceed to translate the strings it
  708. contains.
  709.  
  710. Once a .ct file is done being translated, it must be converted in an IFF
  711. catalog file. This is done by doing:
  712.  
  713.   CatComp app.cd app.ct CATALOG app.catalog
  714.  
  715. This will create a file called app.catalog.
  716.  
  717.  
  718. See the accompanying HelloWorld program for a complete example of a localized
  719. program using the efficient CATCOMP_CODE approach.
  720.  
  721.  
  722. Revision Information
  723. --------------------
  724.  
  725. CatComp 38.2
  726.   - Initial release
  727.  
  728. CatComp 38.7
  729.  
  730.   - No longer complains that %N and %T are unknown formatting commands
  731.     (for support of BCPL strings)
  732.  
  733.   - Added documentation of the # commands for .cd and .ct files
  734.  
  735.   - Added new .cd file command: #header. Lets you specify the base name
  736.     of the header file being generated. The name is used in the #ifdef
  737.     statements at the start of generated C and Assembly header files.
  738.  
  739. CatComp 38.8
  740.  
  741.   - Added new .cd file command: #lengthbytes. Lets you specify the number
  742.     of length bytes to put in front of strings in locale catalogs. The
  743.     default number of bytes is 0. See doc file for more info. This is
  744.     needed for Installer localization.
  745.  
  746. CatComp 38.9
  747.  
  748.   - Now puts an #ifndef around the #include statements in the generated
  749.     C header files to avoid nested includes
  750.  
  751. CatComp 38.10
  752.  
  753.   - Fixed bug with not initializing a variable on the stack upon startup.
  754.     Worked fine under WShell since it allocates the stack as MEMF_CLEAR,
  755.     failed under AmigaShell.
  756.  
  757.   - Fixed bug with processing translation files with empty strings in them
  758.  
  759. CatComp 38.11
  760.  
  761.   - Now supports multi-line strings using standard C line continuation
  762.     notation (\ at EOL)
  763.  
  764. CatComp 38.15
  765.  
  766.   - Fixed assembly source file output. It was including an extraneous
  767.     character at the start of the header files
  768.  
  769. CatComp 38.16
  770.  
  771.   - Now reports a warning when an original string contains a trailing ...
  772.     and a translated one doesn't. Output of the warning can be controlled by
  773.     the VERBOSITY command-line option
  774.  
  775. CatComp 38.17
  776.  
  777.   - Added NOOPTIM command-line option to disable string optimization. This
  778.     is needed in certain cases.
  779.  
  780. CatComp 38.18
  781.  
  782.   - Typecast strings to (STRPTR) in the generated C headers in order to
  783.     keep folks compiling with strict ANSI and signed characters happy.
  784.  
  785. CatComp 38.19
  786.  
  787.   - Added the #array command that can be specified in .cd files. This is in
  788.     support of multi-catalog applications (specifically for AppShell). See
  789.     CatComp.doc for details.
  790.  
  791. CatComp 38.20
  792.  
  793.   - Fixed incorrect handling of return value for calls to StrToLong(). This
  794.     problem showed up with the latest DOS.
  795.  
  796. CatComp 38.21
  797.  
  798.   - Fixed another problem with the new behavior of StrToLong()
  799.  
  800. CatComp 38.22
  801.  
  802.   - The string ID, min length and max length values specified in .cd
  803.     files can now be in hex, by putting a $ in front of them.
  804.  
  805.   - A string ID can now be specified as relative to the previous strings ID
  806.     by putting a + in front of the number. So +1 as a string ID means to add
  807.     one of the string ID. This is useful when deleting obsolete strings
  808.  
  809. CatComp 38.23
  810.  
  811.   - Two new commands can now be specified in a .ct file:
  812.  
  813.     ##rcsid
  814.  
  815.     Lets you embed an RCS-style version string. As the catalog is processed,
  816.     the version string is converted to an AmigaDOS-style version string
  817.     and inserted into the generated catalog. This eliminates the need to
  818.     update version strings in catalogs by hand, since RCS can now do it for
  819.     you. All the V39 catalog files have been updated to use this new feature.
  820.  
  821.     ##name
  822.  
  823.     Lets you specify the name component of a version string, since this cannot
  824.     be done in the ##rcsid command. If the name component is not specified,
  825.     then the current output filename is used.
  826.  
  827. CatComp 38.25
  828.  
  829.   - After almost 3 whole days of looking for a bug which was causing
  830.     random memory to be trashed, the problem was found. Starting with
  831.     version 38.23, CatComp was being linked with the SAS version of the
  832.     sprintf() function. This function pokes random memory! DO NOT USE!
  833.     Switching to use the amiga.lib sprintf() cure everything.
  834.  
  835.   - Now uses SetVBuf() to speed up its IO.
  836.  
  837.   While looking for the above memory trash problem, a few other problems came
  838.   to light
  839.  
  840.   - Memory allocated for .ct files was not being freed if no .catalog was
  841.     being generated.
  842.  
  843.   - A small amount of memory was not being freed if there was a #ifdef
  844.     without a matching #endif in a .cd file
  845.  
  846.   - % commands were not processed in strings containing a NULL ( \0 ) in both
  847.     .cd and .ct files
  848.  
  849.   - Now handles the documented bug in FGets() under V37 by allocating a buffer
  850.     1 byte larger than it needs to be
  851.  
  852. CatComp 39.1
  853.  
  854.   - Added generation of the STRINGBLOCK sections in .h and .i files
  855.  
  856.   - Added generation of object files
  857.  
  858.   - Cleaned up source file generation. New consistent conditional statement
  859.     names allow full control of what does and does not get included for
  860.     both C and Assembly source files
  861.  
  862.   - Added #arrayopts command to define which compiler options are used when
  863.     declaring arrays
  864.  
  865.   - Added #block command to define the name of the data block generated
  866.     when CATCOMP_BLOCK is defined.
  867.  
  868.   - Added #function command to define the name of the function generated
  869.     when CATCOMP_CODE is defined.
  870.  
  871. CatComp 39.2
  872.  
  873.   - Made symbol names case-insensitive
  874.  
  875. CatComp 39.4
  876.  
  877.   - Fixed CATCOMP_ARRAY array name generation.
  878.  
  879.   - The SYMBOLS command-line option now also affects C and Assembly file
  880.     generation
  881.  
  882.   - Added more info to the docs in various places, fixed typos
  883.  
  884. CatComp 39.5
  885.  
  886.   - Added a new command to the .cd files. #prototype lets you specify the
  887.     function prototype to generate in .h files produced from a .cd file.
  888.  
  889. CatComp 39.6
  890.  
  891.   - Fixed bug with not allowing left justified % commands in .ct files
  892.     (%-10s for example)
  893.  
  894. CatComp 39.7
  895.  
  896.   - When reporting errors, it was getting the correct line numbers if any
  897.     of the strings in a .cd or .ct file used the line continuation character
  898.     to have a single string span multiple lines.
  899.  
  900. CatComp 40.1
  901.  
  902.   - When generating a blank .ct file from a .cd file, no longer puts a trailing
  903.     bogus semicolon at the end of comment lines it produces. It used to
  904.     generate:
  905.  
  906.     STRING_NAME
  907.  
  908.     ; this is a string;
  909.  
  910.     It now correctly generates:
  911.  
  912.     STRING NAME
  913.  
  914.     ; this is a string
  915.     ;
  916.  
  917. CatComp 40.2
  918.  
  919.   - Fixed hex number conversion code. Was converting A-F to 0-5 instead
  920.     of 10-15
  921.  
  922. CatComp 40.3
  923.  
  924.   - Added NONUMBERS/S, NOSTRINGS/S, NOARRAY/S, NOBLOCK/S and NOCODE/S as
  925.     command-line options
  926.  
  927. CatComp 40.4
  928.  
  929.   - Added Modula-2 support. This includes a M2FILE/K command-line option,
  930.     and #m2prolog and #m2epilog descriptor file commands.
  931.  
  932. CatComp 40.5
  933.  
  934.   - Any hex numbers in CATCOMP_STRINGS sections will now be separated
  935.     from the text via automatic C string concatenation. This avoids
  936.     compiler misinterpretations. Also, for CATCOMP_CODE a few undefs are
  937.     now generated to avoid preprocessor warnings. The "hiding" of
  938.     LocaleBase via the preprocessor was stupid. I took it out. It
  939.     couldn't have worked anyway. Finally, CATCOMP_CODE should be usable.
  940.  
  941.  
  942. CatComp 44.6
  943.  
  944.   - bumped to version 44
  945.  
  946.   - added XDEF/S Option. If set the identifier and string labels are exported
  947.     using XDEF if ASMFILE is written.
  948.